package net.togogo.mp.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import net.togogo.mp.domain.User;
import net.togogo.mp.domain.dto.UserFormDTO;
import net.togogo.mp.domain.vo.UserVO;
import org.apache.ibatis.annotations.*;

import java.util.List;


public interface UserMapper extends BaseMapper<User> {
    User selectById(Long id);

    @Select("select u.* from user u inner join address a on a.user_id=u.id  ${ew.customSqlSegment}")
    List<User> queryUserByWrapper(@Param("ew") QueryWrapper<User> queryWrapper);
    @Insert("insert into user(username,password,phone,info,balance) values(#{username},#{password},#{phone},#{info},#{balance})")
    void save(UserFormDTO user);
    @Delete("delete from user where id=#{id}")
    void deleteById(Long id);
    @Select("select * from user where id=#{id}")
    UserVO getById(Long id);
    @Select("select * from user")
    List<UserVO> list();


}
